package org.apple.transmitter;

import java.util.Vector;

import org.apple.data.Position;
import org.apple.data.*;

public class ShortFormatter implements Formatter {

	public String format(Position position, Vector<SensorReading> averages) {
		
		String shortMessage ="";
		for (int i=0; i<averages.size();i++){
			switch(averages.get(i).getSensorType()){
			case SensorReading.SPEED :
				shortMessage = shortMessage + "1,"+averages.get(i).getValue()+";"; 
				break;
			case SensorReading.AIRTEMPRATURE :
				shortMessage = shortMessage + "2,"+averages.get(i).getValue()+";"; 
				break;
			case SensorReading.SEATEMPRATURE :
				shortMessage = shortMessage + "3,"+averages.get(i).getValue()+";"; 
				break;
				
			}		
			
		}
		if(position != null){
			
			shortMessage = shortMessage+"4,"+position.getX()+" "+position.getY();
		}
		
		
		return shortMessage;
	}

}